package com.dfbz.demo;

import java.io.FileInputStream;
import java.io.PushbackInputStream;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo06_回退流 {
    public static void main(String[] args) throws Exception {

        PushbackInputStream pis = new PushbackInputStream(new FileInputStream("001.txt"));

        System.out.println((char) pis.read());           // a
        System.out.println((char) pis.read());           // b

        pis.unread('-');
        System.out.println((char) pis.read());           // -

        System.out.println((char) pis.read());           // c
        System.out.println((char) pis.read());           // d


        pis.unread('-');
        System.out.println((char) pis.read());           // -
        System.out.println((char) pis.read());           // e


        pis.close();
    }
}
